//
//  AYMAboutProductController.m
//  QuickCure
//
//  Created by 徐绩 on 16/5/6.
//  Copyright © 2016年 ayumi. All rights reserved.
//

#import "AYMAboutProductController.h"
#import "AYMBaseWebViewController.h"

@interface AYMAboutProductController ()

@end

@implementation AYMAboutProductController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"关于产品";
    [self setHeaderView];
    [self setFooterView];
    
}

#pragma mark - 私有方法

-(void)setHeaderView{
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, screenW, 300)];
    UIImageView *image1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"product_img_logo_nor.png"]];
    UIImageView *image2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"product_text_logo_nor.png"]];
    [headerView addSubview:image1];
    [headerView addSubview:image2];
    self.tableView.tableHeaderView = headerView;

    [image1 makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(headerView);
        make.top.equalTo(self.view).offset(100);
    }];
    [image2 makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(image1);
        make.top.equalTo(image1.bottom).offset(10);
    }];
    }
-(void)setFooterView{
    UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, screenW, 200)];
    UILabel *label1 = [[UILabel alloc]init];
    label1.text = @"用户交流群:8888888";
    label1.textColor = LeftHeadViewColor;
    
    
    
    UILabel *label2 = [[UILabel alloc]init];
    label2.textColor = [UIColor grayColor];
    label2.text = @"Version:1.4.0";
    [footerView addSubview:label1];
    [footerView addSubview:label2];
    self.tableView.tableFooterView = footerView;
    [label1 makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(footerView).offset(100);
        make.centerX.equalTo(footerView);
    }];
    [label2 makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label1.bottom).offset(5);
        make.centerX.equalTo(footerView);
    }];
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    AYMBaseWebViewController *vc = [[AYMBaseWebViewController alloc]initWithUrlString:@"https://www.baidu.com" andTitle:@"关于产品"];
    [self.navigationController pushViewController:vc animated:YES];
    
}

#pragma mark - 数据源方法 

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
   
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = @"用户协议";
    cell.imageView.image = [UIImage imageNamed:@"product_img_icon_xieyi.png"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

@end
